<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>播放中</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css"/>
    <style>
        .jxjk{
            padding: 5px 5px;
            background-color: #93cc93;
            border-radius: 6px;
        }
        .jxjk2{
            padding: 10px;
            background-color: #93cc93;
            border-radius: 6px;
            float: left;
            /*width: 65px;*/
        }

        .jxjk3{
            padding: 5px 5px;
            /*background-color: green;*/
            border-radius: 6px;
        }
        /* .bigdiv{
             background-color: #a7bdcd;
             border-radius: 8px;
             padding: 10px;
         }*/
    </style>
</head>
<body>
<header class="aui-navBar aui-navBar-fixed"  id="aui-header">
    <a tapmode onclick="closeWin()" class="aui-navBar-item">
        <i class="icon icon-back"></i>
    </a>
    <div class="aui-center">
        <span class="aui-center-title mike-txt-title" id="title" >播放中</span>
    </div>
    <a class="aui-navBar-item" style="color: #725f5f;">
        <i class="icon"></i>
    </a>
</header>
<div id="search_a" style="padding: 12px">
    <div>正在播放：
        <span style="color: red" id="p_title"></span>&emsp;
        <span style="color: blue;font-size: 13px" id="p_js"></span>
        <span style="color: #e4330b;font-size: 13px" >接口<span id="p_jk">1</span></span>
    </div>
    <div id="ifranme"></div>

    <div style="text-align: center" class="bigdiv">
        <div style="padding-top: 2px;padding-bottom: 8px">不能播放可切换解析接口</div>
        <div>
            <?php foreach($jiexi as $k=>$v){?>
            <span class="jxjk" onclick="jx('<?=$v?>','<?=$k+1?>')">接口<?=$k+1?></span>
            <?php }?>
        </div>
    </div>

    <div style="text-align: center" class="bigdiv">
        <div style="padding-top: 2px;padding-bottom: 8px">切换播放源</div>
        <?php foreach($bfq as $value){?>
        <span class="jxjk <?=$value?> aptpl" onclick="b_pt('<?=$value?>')"><?=$value?></span>
        <?php }?>
    </div>

    <div style="text-align: center;padding:6px" class="bigdiv">
        <div style="padding-top: 8px;padding-bottom: 8px"></div>
        <div>
            <?php foreach($bfq as $value){?>
            <div id="dis<?=$value?>" class="ptdisplay" style="display:none">
                <?php foreach($data['url'][$value] as $k=>$v){?>
                <span class="jxjk2"onclick="jx2('<?=$v['url']?>','<?=$v['name']?>')"><?=$v['name']?>
                    </span>
                <?php }?>
            </div>
            <?php }?>
        </div>
    </div>
</div>
</body>

<script type="text/javascript" src="../script/api.js" ></script>
<script type="text/javascript" src="../script/doT.js"></script>
<script type="text/javascript">

    $(function () {
        api_url = localStorage.getItem('api_url')
        layui.use('layer', function () {
            layer = layui.layer
        });
        var b_url="<?=$moren['mr_url']?>";//默认播放地址
        var b_pt="<?=$moren['mr_pt']?>";//默认视频源
        var b_jx="<?=advert(8)?>";//默认解析接口1
        localStorage.setItem('b_url',b_url);
        localStorage.setItem('b_jx',b_jx);
        localStorage.setItem('b_pt',b_pt);
        $("#ifranme").html("<iframe allowfullscreen='true' allow='autoplay' src='"+b_jx+b_url+"' style='width: 99%;height:300px'></iframe>");
        //默认第一个播放源
        $("."+b_pt+"").css("color","blue");
        $("#dis"+b_pt+"").css("display","block");
    });

    function jx(b_jx,num) {
        localStorage.setItem('b_jx',b_jx);
        var b_url=localStorage.getItem('b_url');
        console.log('播放地址：'+b_jx+b_url);
        $("#p_jk").text(num);
        $("#ifranme").html("<iframe allowfullscreen='true' allow='autoplay' src='"+b_jx+b_url+"' style='width: 99%;height:300px'></iframe>");
    }

    function jx2(b_url,name) {
        localStorage.setItem('b_url',b_url);
        var b_jx= localStorage.getItem('b_jx');
        console.log('播放地址：'+b_jx+b_url);
        $("#p_js").text(name);
        $("#ifranme").html("<iframe allowfullscreen='true' allow='autoplay' src='"+b_jx+b_url+"' style='width: 99%;height:300px'></iframe>");
    }

    function b_pt(b_pt) {
        layer.alert('切换成功，请选择要播放的资源');
        //先全部隐藏
        $(".ptdisplay").css('display',"none")
        $(".aptpl").css('color',"")
        $("#dis"+b_pt+"").css('display',"block");
        $("."+b_pt+"").css('color',"blue");
        $("#ifranme").html("<iframe allowfullscreen='true' allow='autoplay' src='' style='width: 99%;height:300px'>切换视频源，需要重新选集</iframe>");
    }





</script>
<script type="text/javascript">
    apiready = function(){
        api.parseTapmode();
        var header = $api.byId('aui-header');
        $api.fixStatusBar(header);
        var headerPos = $api.offset(header);
        var body_h = $api.offset($api.dom('body')).h;

        var search_a = $api.byId('search_a');//位置
        var search_b = $api.byId("search_b");//模板
        var vod_id = api.pageParam.vod_id;//关键词
        var api_url = localStorage.getItem('api_url');
        api.ajax({
            url: api_url + '/login/login/searchplay.html',
            method: 'get',
            data: {
                values: {
                    vod_id:vod_id
                }
            }
        }, function (ret, err) {
            if (ret) {
                //
                $api.byId('p_title').innerHTML=ret.title;
                $api.byId('p_js').innerHTML=ret.mr_js;








            } else {
                api.toast({
                    msg: '加载中'
                });
            }
        });
    }
    function closeWin(){
        var browser = api.require('webBrowser');
        browser.historyBack(
            function(ret, err) {
                if (!ret.status) {
                    api.closeWin();
                }
            }
        );
    }
</script>
</html>
